package cn.org.eshow.webapp.action.response;

import cn.org.eshow.bean.query.BaseQuery;
import cn.org.eshow.model.OrderItem;

import java.util.Date;

/**
 * 订单商品清单查询对象
 */
public class OrderItemResponse extends BaseQuery {

    public Integer id;//订单商品清单ID
    public Date addTime;//添加时间
    public String no;//订单号
    public String type;//价格类型（会员价，促销价）
    public Double price;//价格
    public Double origPrice;//原价
    public Integer quantity;//数量
    public Boolean ifComment;//是否评论
    public ProductItemResponse productItem;//详细商品
    public ProductResponse product;//商品ID
    public ProductOrderResponse productOrder;//订单ID
    public UserResponse user;//用户Id

    public OrderItemResponse(OrderItem orderItem) {
        this.id = orderItem.getId();
        this.addTime = orderItem.getAddTime();
        this.no = orderItem.getNo();
        this.type = orderItem.getType();
        this.price = orderItem.getPrice();
        this.origPrice = orderItem.getOrigPrice();
        this.quantity = orderItem.getQuantity();
        this.ifComment = orderItem.getIfComment();
        if (orderItem.getProduct() != null) {
            this.product = new ProductResponse(orderItem.getProduct());
        }
        if (orderItem.getProductItem() != null) {
            this.productItem = new ProductItemResponse(orderItem.getProductItem());
        }
        if (orderItem.getProductOrder() != null) {
            this.productOrder = new ProductOrderResponse(orderItem.getProductOrder());
        }
        if (orderItem.getUser() != null) {
            this.user = new UserResponse(orderItem.getUser());
        }
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getAddTime() {
        return addTime;
    }

    public void setAddTime(Date addTime) {
        this.addTime = addTime;
    }


    public String getNo() {
        return no;
    }

    public void setNo(String no) {
        this.no = no;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public Double getPrice() {
        return price;
    }

    public void setPrice(Double price) {
        this.price = price;
    }

    public Double getOrigPrice() {
        return origPrice;
    }

    public void setOrigPrice(Double origPrice) {
        this.origPrice = origPrice;
    }

    public Integer getQuantity() {
        return quantity;
    }

    public void setQuantity(Integer quantity) {
        this.quantity = quantity;
    }

    public ProductItemResponse getProductItem() {
        return productItem;
    }

    public void setProductItem(ProductItemResponse productItem) {
        this.productItem = productItem;
    }

    public ProductResponse getProduct() {
        return product;
    }

    public void setProduct(ProductResponse product) {
        this.product = product;
    }

    public UserResponse getUser() {
        return user;
    }

    public void setUser(UserResponse user) {
        this.user = user;
    }

    public ProductOrderResponse getProductOrder() {
        return productOrder;
    }

    public void setProductOrder(ProductOrderResponse productOrder) {
        this.productOrder = productOrder;
    }

    public Boolean getIfComment() {
        return ifComment;
    }

    public void setIfComment(Boolean ifComment) {
        this.ifComment = ifComment;
    }
}
